package org.mili.ticketeer.dto;

import org.mili.application.dto.Archivable;
import org.mili.application.dto.Attributeable;
import org.mili.application.dto.Field;

import java.util.HashMap;
import java.util.Map;

public class ContactMeeting extends Attributeable implements Archivable {

    public static enum Fields implements Field {
        CONTACT,
        MEETING;
    }

    public static enum UniqueFields implements Field {
        CONTACT,
        MEETING;
    }

    public static final String TABLE = "contact_meeting";

    private int contact;
    private int meeting;

    public Map<Field, Object> valueMap() {
        Map<Field, Object> map = new HashMap<>();
        map.put(Fields.MEETING, getMeeting());
        map.put(Fields.CONTACT, getContact());
        return map;
    }

    public Map<Field, Object> valueMapWithoutId() {
        return valueMap();
    }

    @Override
    public Map<Field, Object> getUniqueFields() {
        return valueMap();
    }

    public int getContact() {
        return contact;
    }

    public void setContact(int contact) {
        this.contact = contact;
    }

    public int getMeeting() {
        return meeting;
    }

    public void setMeeting(int meeting) {
        this.meeting = meeting;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ContactMeeting that = (ContactMeeting) o;

        if (contact != that.contact) return false;
        if (meeting != that.meeting) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = contact;
        result = 31 * result + meeting;
        return result;
    }

    @Override
    public String toString() {
        return "ContactMeeting{" +
                "contact=" + contact +
                ", meeting=" + meeting +
                '}';
    }
}
